package com.example.leon.demo.Activity;


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.leon.demo.R;

import java.util.Timer;
import java.util.TimerTask;
import java.util.jar.Attributes;

/**
 * Created by wang.long on 2016/3/29.
 */
public class TitleLayout extends LinearLayout {
    private static Toast toast;

    public TitleLayout(final Context context,AttributeSet attrs){
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.title, this);
        LinearLayout titleBack=(LinearLayout) findViewById(R.id.title_back);
        LinearLayout titleEdit=(LinearLayout) findViewById(R.id.title_edit);

        titleBack.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                ((Activity) getContext()).finish();
            }
        });

        titleEdit.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                if(toast==null){
                    toast=Toast.makeText(getContext(),"you click  edit button",Toast.LENGTH_SHORT);
                    toast.show();
                }


            }
        });

    }
}
